package com.gupaoedu.baifc.singleton;

import java.io.Serializable;

/**
 * projectName: baifc_singleton
 * packageName: com.gupaoedu.baifc.hungrysingleton
 * Created: 2019/3/12.
 * Auther: baifc
 * Description: 饿汉式单例
 */
public class HungrySingleton implements Serializable {

    private HungrySingleton() {}

//    public static final HungrySingleton hungrySingleton = new HungrySingleton();

    public static final HungrySingleton hungrySingleton;

    static {
        hungrySingleton = new HungrySingleton();
    }

    public static HungrySingleton getInstance() {
        return hungrySingleton;
    }

//    private Object readResolve() {
//        return hungrySingleton;
//    }

}
